home *** CD-ROM | disk | FTP | other *** search
-
-
- function PlayIntroMenu()
- -- Close main window
- if( ( HUD == nil or HUD.GetCurrentWindow() == "" ) and ( GameState ~= InLevel ) ) then
- PlayIntro()
- end
- end
-
- -- Quick Start Function:
- function QuickStart()
- StartLevel( "Scripts/QuickStartStartup.lua" );
- end
-
- function StartTutorial()
- StartLevel( "Scripts/Tutorial.lua" );
- end
-
- function StartCampaign1()
- StartLevelCampaign( 1 );
- end
- function StartCampaign2()
- StartLevelCampaign( 2 );
- end
- function StartCampaign3()
- StartLevelCampaign( 3 );
- end
- function StartCampaign4()
- StartLevelCampaign( 4 );
- end
- function StartCampaign5()
- StartLevelCampaign( 5 );
- end
- function StartCampaign6()
- StartLevelCampaign( 6 );
- end
- function StartCampaign7()
- StartLevelCampaign( 7 );
- end
- function StartCampaign8()
- StartLevelCampaign( 8 );
- end
- function StartCampaign9()
- StartLevelCampaign( 9 );
- end
- function StartCampaign10()
- StartLevelCampaign( 10 );
- end
-
-
- function NextCampaignLevel()
-
- if( InCampaign ) then
- -- Start the next level of the game:
- Obj = G.GetCogName( "Camera" );
- Obj.Destroy();
-
- G.DestroyGroup("camera");
- G.Create( "Data/BasicCamera.xml" );
- MainMenu.CloseWindow( "GameOverWindow" );
-
- if( not( CurrentLevel == MaxLevelNum ) and GameState == Victory ) then
- CurrentLevel = CurrentLevel + 1
- end
-
- StartLevelCampaign( CurrentLevel )
- end
- end
-
- function ChooseLevel( filename, number )
- CurrentLevel = number + 1
- StartLevelCampaign( CurrentLevel )
- end
-
-
- function StartPhysicsMode()
- G.ActivateBackground( -1 );
- MainMenu.CloseWindow( "LevelChoiceWindow" );
- G.LogicCreateLevel("Scripts/PhysicsStartup.lua");
- end
-
- function ExitGame()
- G.Exit();
- end
-
- function SetMusicFolder( name )
- G.ChangeMusicFolder( folderName );
- G.PlayRandomSong();
- end
-
- function PauseMusic( pause )
- if( pause ) then
- G.PauseMusic();
- else
- G.PlayMusic();
- end
- end
-
- EscPauseStatus = true
- EscCursorStatus = true
- function OpenInGame()
-
- EscPauseStatus = G.IsPaused()
- EscCursorStatus = G.IsCursorActive()
-
- G.OnlyShowMouseOnGui( false );
-
- -- Tutorial stuff
- KillTextPopup()
-
- MainMenu.OpenWindow( "InGameWindow", false );
- G.SetCursorActive( false );
- G.SetPause( true );
- end
-
- function ResumeGame()
- MainMenu.CloseWindow( "InGameWindow" );
- G.SetPause( EscPauseStatus );
- G.SetCursorActive( EscCursorStatus );
-
- G.OnlyShowMouseOnGui( true );
- end
-
- function ExitInGame()
- G.SetGameState( QuitLevel )
- end
-
- function EnableInvaderSpeech( value )
- G.InvaderSpeech( value )
- end
-
-
- function OpenBonus()
- -- DisableTraitor();
- MainMenu.OpenWindow( "BonusWindow", true );
- end
-
- function OpenLevelChoice()
- -- DisableTraitor();
- MainMenu.OpenWindow( "LevelChoiceWindow", true );
- end
-
- function ExitLevelChoice()
- MainMenu.OpenWindow( "StartWindow" , true );
- end
-
- function ExitInvaderViewer()
- MainMenu.OpenWindow( "BonusWindow", true );
- end
-
- function OpenCredits()
- MainMenu.OpenWindow( "CreditsWindow", true );
- end
-
-
- function OpenControls()
- MainMenu.OpenWindow( "ControlsWindow", true );
- end
-
- function ExitControls()
- MainMenu.OpenWindow( "BonusWindow", true );
- end
-
-
- function OpenInvaderViewer()
- MainMenu.OpenWindow( "InvaderViewerWindow", true );
- end
-
-
- function ExitCredits()
- MainMenu.OpenWindow( "BonusWindow" , true );
- end
-
- function ExitBonus()
- if( LevelActive ) then
- MainMenu.OpenWindow( "InGameWindow" , true );
- else
- MainMenu.OpenWindow( "StartWindow" , true );
- end
- end
-
-
-
- function HideGameOver()
-
- InCampaign = false;
-
- MainMenu.OpenWindow( "StartWindow", true);
- G.ActivateBackground( 0 );
- Obj = G.GetCogName( "Camera" );
- Obj.Destroy();
-
- G.DestroyGroup("camera");
- G.Create( "Data/BasicCamera.xml" );
-
- end
-
- function GameOverScreen( text )
- G.UpdateGameOverStats();
- MainMenu.Message( "GameOverText", "SetText", text);
- if( GameState == Victory ) then
- G.ActivateBackground( 1 );
- else
- G.ActivateBackground( 2 );
- end
- end
-
- dofile( "Scripts/GameSettings.lua" );
-
-
- LevelPics = {}
- LevelPics.Tutorial = "Textures/LevelPics/Tutorial.png"
- LevelPics.Challenge = "Textures/LevelPics/Challenge.png"
- LevelPics.Campaign1 = "Textures/LevelPics/Campaign1.png"
- LevelPics.Campaign2 = "Textures/LevelPics/Campaign2.png"
- LevelPics.Campaign3 = "Textures/LevelPics/Campaign3.png"
- LevelPics.Campaign4 = "Textures/LevelPics/Campaign4.png"
- LevelPics.Campaign5 = "Textures/LevelPics/Campaign5.png"
- LevelPics.Campaign6 = "Textures/LevelPics/Campaign6.png"
- LevelPics.Campaign7 = "Textures/LevelPics/Campaign7.png"
- LevelPics.Campaign8 = "Textures/LevelPics/Campaign8.png"
- LevelPics.Campaign9 = "Textures/LevelPics/Campaign9.png"
- LevelPics.Campaign10 = "Textures/LevelPics/Campaign10.png"
-
- waitTime = 30
-
- function LevelChoiceUpdate()
- if( LevelPics[ GuiObjectOver ] ~= nil ) then
- MainMenu.Message( "LevelImageBox", "SetImage", LevelPics[ GuiObjectOver ] );
- end
-
- -- Wait 30 Seconds on mainmenu for replay.
- if( MainMenu.GetCurrentWindow() == "StartWindow" ) then
- waitTime = waitTime - GameTimeDiff
- if( waitTime <= 0 ) then
- waitTime = 30
- PlayIntroMenu()
- end
- elseif( true ) then
- waitTime = 30
- end
- end
-
- GMain["LevelChoiceUpdate"] = LevelChoiceUpdate
-
-